<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>⼆进制转⼗进制，⼗进制转⼆进制</title>
</head>

<body>
  <script>
    var decimalNum = 123;
    console.log(decimalNum.toString(2));


    var str = "1111011";
    console.log(parseInt(str, 2));
  </script>
</body>

</html>